package com.dc.system.model;


import com.dc.system.mapper.ApprovalMapper;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;
import java.util.*;
import java.util.regex.Pattern;

import static java.util.regex.Pattern.compile;

/**
 * @Description: ApprovalProcess 审批流程，所有需要用到审批的实体类的父类（即所有的审批的参数，具体的流程）
 * @Author: ChenXueLi
 * @Date: 2018-05-02 13:52
 */
public class ApprovalProcess implements Serializable{

    @Autowired
    private ApprovalMapper approvalMapper;

    /**
     * 主键id
     */
    private Integer process_id;

    /**
     * 模板id编号
     */
    private Integer approval_model_id;

    /**
     * 模板
     */
    private ApprovalModel approval_model;

    /**
     * 审批人（多人用,分隔）
     */
    private String approver;

    /**
     * 审批人集合
     */
    private List<SysUser> approver_list;

    /**
     * 当前的审批人（多人用,分隔）
     */
    private String current_approver;

    /**
     * 当前审批人的序号
     */
    private Integer current_approver_order;

    /**
     * 需要通过的人数
     */
    private Integer pass_approver_count;

    /**
     * 完成状态 0未知，1未开始，2刚开始，3进行中，4已结束
     */
    private Integer approval_state;

    /**
     * 当前审批的历史
     */
    private List<ApprovalHistory> approval_histories;

    /**
     * 补缺 0开启 1不开启（默认开启，防止审批流程断层）
     */
    private Integer fill_vacancy;

    /**
     * 当前流程审批的结果（0未通过 1通过 2未审核）
     */
    private Integer approval_result;

    /**
     * 分条件的值，如果其中的值有多个用,分隔
     */
    private String approval_proviso_value;

    /**
     * 分条件的值的集合（不做数据库存储，只使用）
     */
    List<Object> approval_proviso_value_list;

    /**
     * 创建人用户id
     */
    private int create_user_id;

    /**
     * 创建人用户名
     */
    private String create_user_name;

    /**
     * 创建时间
     */
    private Date create_time;

    /**
     * 更新人用户id
     */
    private int update_user_id;

    /**
     * 更新人用户名
     */
    private String update_user_name;

    /**
     * 更新时间
     */
    private Date update_time;

    /**
     * 0删除1存在
     */
    private int is_deleted;

    /**
     * 版本号
     */
    private int version;

    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    public Integer getPass_approver_count() {
        return pass_approver_count;
    }

    public void setPass_approver_count(Integer pass_approver_count) {
        this.pass_approver_count = pass_approver_count;
    }

    public Integer getProcess_id() {
        return process_id;
    }

    public void setProcess_id(Integer process_id) {
        this.process_id = process_id;
    }

    public Integer getApproval_model_id() {
        return approval_model_id;
    }

    public void setApproval_model_id(Integer approval_model_id) {
        this.approval_model_id = approval_model_id;
    }

    public ApprovalModel getApproval_model() {
        return approval_model;
    }

    public void setApproval_model(ApprovalModel approval_model) {
        this.approval_model = approval_model;
    }

    public String getApprover() {
        return approver;
    }

    public void setApprover(String approver) {
        this.approver = approver;
    }

    public List<SysUser> getApprover_list() {
        String[] temp = this.approver.split(",");
        this.approver_list = new ArrayList<>();
        for(String str : temp) {
            SysUser sysUser = new SysUser();
            sysUser.setAccount(str);
            sysUser.setName(str);
            this.approver_list.add(sysUser);
        }
        return approver_list;
    }

    public void setApprover_list(List<SysUser> approver_list) {
        this.approver_list = approver_list;
    }

    public String getCurrent_approver() {
        return current_approver;
    }

    public void setCurrent_approver(String current_approver) {
        this.current_approver = current_approver;
    }

    public Integer getCurrent_approver_order() {
        return current_approver_order;
    }

    public void setCurrent_approver_order(Integer current_approver_order) {
        this.current_approver_order = current_approver_order;
    }

    public Integer getApproval_state() {
        return approval_state;
    }

    public void setApproval_state(Integer approval_state) {
        this.approval_state = approval_state;
    }

    public List<ApprovalHistory> getApproval_histories() {
        return approval_histories;
    }

    public void setApproval_histories(List<ApprovalHistory> approval_histories) {
        this.approval_histories = approval_histories;
    }

    public Integer getFill_vacancy() {
        return fill_vacancy;
    }

    public void setFill_vacancy(Integer fill_vacancy) {
        this.fill_vacancy = fill_vacancy;
    }

    public Integer getApproval_result() {
        return approval_result;
    }

    public void setApproval_result(Integer approval_result) {
        this.approval_result = approval_result;
    }

    public int getCreate_user_id() {
        return create_user_id;
    }

    public void setCreate_user_id(int create_user_id) {
        this.create_user_id = create_user_id;
    }

    public String getCreate_user_name() {
        return create_user_name;
    }

    public void setCreate_user_name(String create_user_name) {
        this.create_user_name = create_user_name;
    }

    public Date getCreate_time() {
        return create_time;
    }

    public void setCreate_time(Date create_time) {
        this.create_time = create_time;
    }

    public int getUpdate_user_id() {
        return update_user_id;
    }

    public void setUpdate_user_id(int update_user_id) {
        this.update_user_id = update_user_id;
    }

    public String getUpdate_user_name() {
        return update_user_name;
    }

    public void setUpdate_user_name(String update_user_name) {
        this.update_user_name = update_user_name;
    }

    public Date getUpdate_time() {
        return update_time;
    }

    public void setUpdate_time(Date update_time) {
        this.update_time = update_time;
    }

    public int getIs_deleted() {
        return is_deleted;
    }

    public void setIs_deleted(int is_deleted) {
        this.is_deleted = is_deleted;
    }

    public String getApproval_proviso_value() {
        return approval_proviso_value;
    }

    public void setApproval_proviso_value(String approval_proviso_value) {
        this.approval_proviso_value = approval_proviso_value;
    }

    public List<Object> getApproval_proviso_value_list() {
        return approval_proviso_value_list;
    }

    public void setApproval_proviso_value_list(List<Object> approval_proviso_value_list) {
        this.approval_proviso_value_list = approval_proviso_value_list;
    }
}
